#pragma once
#include "imagebutton.h"
#include "imageclip.h"

class SClipPallette;

class SClipPalletteEntry : public Button
{
protected:
	ImageClip * m_clipEntry;
public:
	/** the memory address of the clip that this clip entry was spawned from */
	ImageClip * getClipEntry(){return m_clipEntry;}
	void setClip(ImageClip * a_clip)
	{
		m_clipEntry = a_clip;
		getArea()->setDimension(a_clip->clip.getDimension());
	}
	void refreshArea(){setClip(m_clipEntry);}
	/** draws the clip without the UI background color */
	void draw(SDL_Surface * a_screen)
	{
		VSDL_drawRect(a_screen, getArea(), 0, 1);
		if(m_clipEntry)
			m_clipEntry->draw(a_screen, m_dimension.getMin(), ImageClip::DEFAULT_TRANSPARENT_INDEX);
	}

	SClipPalletteEntry():m_clipEntry(0){}
	SClipPalletteEntry(ImageClip * a_clip){setClip(a_clip);}
	void copy(const SClipPalletteEntry & b)
	{
		m_clipEntry = b.m_clipEntry;
		Button::copy(b);
	}
};